//
//  ViewController.m
//  autoHome
//
//  Created by qianfeng on 15/9/9.
//  Copyright (c) 2015年 qf1523. All rights reserved.
//

#import "ViewController.h"
#import "recommendViewController.h"
#import "forumViewController.h"
#import "findViewController.h"
#import "lookForCarViewController.h"
#import "MineViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
  
    [self creatTabBar];
    
}
-(void)creatTabBar{
    NSString * path = [[NSBundle mainBundle]pathForResource:@"AHNightSkin" ofType:@"plist"];
    NSDictionary * dict1 = [NSDictionary dictionaryWithContentsOfFile:path];
    NSDictionary * dict2 = dict1[@"img"];
    NSDictionary * dict3 = dict2[@"tabbarcontroller"];
    
    recommendViewController * recommend = [[recommendViewController alloc]init];
    recommend.tabBarItem.image = [UIImage imageNamed:dict3[@"item01"]];
    recommend.tabBarItem.selectedImage = [UIImage imageNamed:dict3[@"item01_selected"]];
    UINavigationController * nav1 = [[UINavigationController alloc]initWithRootViewController:recommend];
    
    forumViewController * forum = [[forumViewController alloc]init];
    forum.tabBarItem.image = [UIImage imageNamed:dict3[@"item02"]];
    forum.tabBarItem.selectedImage = [UIImage imageNamed:dict3[@"item02_selected"]];
    UINavigationController * nav2 = [[UINavigationController alloc]initWithRootViewController:forum];
    
    lookForCarViewController * lookFor = [[lookForCarViewController alloc]init];
    lookFor.tabBarItem.image = [UIImage imageNamed:dict3[@"item03"]];
    lookFor.tabBarItem.selectedImage = [UIImage imageNamed:dict3[@"item03_selected"]];
    UINavigationController * nav3 = [[UINavigationController alloc]initWithRootViewController:lookFor];
    

    
    findViewController * find = [[findViewController alloc]init];
    find.tabBarItem.image = [UIImage imageNamed:dict3[@"item04"]];
    find.tabBarItem.selectedImage = [UIImage imageNamed:dict3[@"item04_selected"]];
    UINavigationController * nav4 = [[UINavigationController alloc]initWithRootViewController:find];
    
    MineViewController * mine = [[MineViewController alloc]init];
    mine.tabBarItem.image = [UIImage imageNamed:dict3[@"item05"]];
    mine.tabBarItem.selectedImage = [UIImage imageNamed:dict3[@"item05_selected"]];
    UINavigationController * nav5 = [[UINavigationController alloc]initWithRootViewController:mine];
    
    UITabBarController * tabBar = [[UITabBarController alloc]init];
    tabBar.viewControllers = @[nav1,nav2,nav3,nav4,nav5];
    [self.view addSubview:tabBar.view];
    [self addChildViewController:tabBar];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
